/*
 * 作者：姚俊
 * 功能：用于教师成员信息现实的action
 * 日期：2015-05-22
 */
package admin.action.baseInfo;
import java.util.*;

import admin.action.fruits.Constant;
import admin.service.member.TeacherService;

import teacher.bean.Teacher;
import teacher.service.teacher;

public class MemberInfoAction {
	
	
	private List<Teacher> teachers;
	private int teaCount;
	private int flag;
	//当前页
	private int currentPage;
	//最后一页
	private int endPage;
	private int counts;

	public List<Teacher> getTeachers() {
		return teachers;
	}

	public void setTeachers(List<Teacher> teachers) {
		this.teachers = teachers;
	}
	
	public int getTeaCount() {
		return teaCount;
	}

	public void setTeaCount(int teaCount) {
		this.teaCount = teaCount;
	}
	
	public int getCurrentPage() {
		return currentPage;
	}

	public void setCurrentPage(int currentPage) {
		this.currentPage = currentPage;
	}

	public int getEndPage() {
		return endPage;
	}

	public void setEndPage(int endPage) {
		this.endPage = endPage;
	}

	public int getCounts() {
		return counts;
	}

	public void setCounts(int counts) {
		this.counts = counts;
	}
	

	public int getFlag() {
		return flag;
	}

	public void setFlag(int flag) {
		this.flag = flag;
	}

	public String execute()
	{
		
		//当当前页为零的时候，把当前页变成1
		if(this.getCurrentPage()==0)
			this.setCurrentPage(1);
		
		int add=0;
		//最后一页
		if(new teacher().getCountTeacher()%Constant.pageSize!=0)
		{
			add=1;
		}
				
		this.setEndPage(new teacher().getCountTeacher()/Constant.pageSize+add);
		this.setCounts(new teacher().getCountTeacher());
		teachers=new TeacherService().getSegregateTeacherByAll(
				(this.getCurrentPage()-1)*Constant.pageSize+1,Constant.pageSize);
		return "succ";
	}

}
